package com.lzh.redisdemo.controller;

import com.lzh.redisdemo.pojo.vo.DateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Classname DateTestController
 * @Description TODO
 * @Date 2021/11/4 16:20
 * @Created by liuzihao
 */
@Api(value = "date转换测试")
@RestController
@RequestMapping("/date")
public class DateTestController {

    @ApiOperation(value = "date转换测试")
//    @ApiImplicitParams({
//            @ApiImplicitParam(paramType = "date",name = "")
//    })
    @RequestMapping(value = "/test",method = RequestMethod.POST)
    public DateVo getDate(DateVo vo) {
        System.out.println("date1:" + vo.getDate());

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
        String date = sdf.format(vo.getDate());
        System.out.println("date2:" + date);

        DateVo vo2 = new DateVo();
        vo2.setDate(new Date());
        return vo2;
    }

}
